package com.minosiants.dann.service
import com.minosiants.dann.data.OauthData

import org.scribe.oauth._
import org.scribe.model._
import org.junit.Test;import com.minosiants.dann.repository._
import org.junit.Assert._
class OauthServiceTest{
	@Test
	def authorizationUrlFor(){
		val mongoRepository=new MongoRepository
		//mongoRepository.drop(OauthData.collectionName)
		val oauthService=new OauthServiceImpl(DummyOAuthService,mongoRepository)
		val url=oauthService.authorizationUrlFor("minosiants")
		assertEquals(DummyOAuthService.url,url)
	}
	
	object DummyOAuthService extends  OAuthService{
		val url="https://twitter.com/oauth/authorize?oauth_token=p7koJTBdQnvUrikl0bMcvHk8yp1BlkkFqCYxg6VDhI"
		override def getRequestToken()={
			new Token("lala","GUTzgLzShnuT1Qyv3RPbScTiqSGSQj2rPVNW81Nc");
		}
		override def getAccessToken(requestToken:Token, verifier:Verifier )={
			new Token("","");
		}
		override def signRequest( accessToken:Token,  request:OAuthRequest){
			
		}
		 override def getVersion()={
			 ""
		 }
		 override def addScope(scope:String)={
			 
		 }
		 override def getAuthorizationUrl(requestToken:Token)={
			url
		 }
	}
}